﻿using System;
using System.Collections.Generic;

using System.IO;
using System.Net;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace SilverlightFTP.Web
{
    public partial class _Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            // Get the object used to communicate with the server.
            FtpWebRequest request = (FtpWebRequest)WebRequest.Create("ftp://u187888.ftp.masterhost.ru/fudzen.studenthost.ru/www/");
            request.Method = WebRequestMethods.Ftp.ListDirectoryDetails;
            
            // This example assumes the FTP site uses anonymous logon.
            request.Credentials = new NetworkCredential("u187888", "paceaefulour3");

            
            FtpWebResponse response = (FtpWebResponse)request.GetResponse();
            
            Stream responseStream = response.GetResponseStream();
            StreamReader reader = new StreamReader(responseStream);
            string s=reader.ReadLine();
            while (!reader.EndOfStream)
            {
                Response.Write("+++"+s+"<br/>");
                s = reader.ReadLine();
            }

            Response.Write("Directory List Complete, status {0}"+ response.StatusDescription);

            reader.Close();
            response.Close();


        }
    }
}
